package com.yic.module.qms.dal.mysql.inspectinfo;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.qms.dal.dataobject.inspectinfo.InspectInfoDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.qms.controller.admin.inspectinfo.vo.*;

/**
 * 检验单身 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface InspectInfoMapper extends BaseMapperX<InspectInfoDO> {

    default PageResult<InspectInfoDO> selectPage(InspectInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectInfoDO>()
                .eqIfPresent(InspectInfoDO::getInspectId, reqVO.getInspectId())
                .eqIfPresent(InspectInfoDO::getInspectType, reqVO.getInspectType())
                .eqIfPresent(InspectInfoDO::getSchemeId, reqVO.getSchemeId())
                .eqIfPresent(InspectInfoDO::getEntryId, reqVO.getEntryId())
                .orderByDesc(InspectInfoDO::getId));
    }

    default List<InspectInfoDO> selectList(InspectInfoExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InspectInfoDO>()
                .eqIfPresent(InspectInfoDO::getInspectId, reqVO.getInspectId())
                .eqIfPresent(InspectInfoDO::getInspectType, reqVO.getInspectType())
                .eqIfPresent(InspectInfoDO::getSchemeId, reqVO.getSchemeId())
                .eqIfPresent(InspectInfoDO::getEntryId, reqVO.getEntryId())
                .orderByDesc(InspectInfoDO::getId));
    }

    default List<InspectInfoDO> selectListByInspectId(Long id) {
        return selectList(new LambdaQueryWrapperX<InspectInfoDO>()
                .eq(InspectInfoDO::getInspectId, id));
    }
}
